package com.xywy.bloodandroid.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.xywy.bloodandroid.dao.DaoMaster.DevOpenHelper;

/**
 * greenDao 初始类
 * 
 * @author xgd
 */
public class BaseDao {

	private static BaseDao baseDao = null;

	private String DATABASE_NAME = "xywy.db"; // 数据库名称
	private SQLiteDatabase db;
	private DaoMaster daoMaster;
	private DaoSession daoSession;

	private BaseDao(Context context) {
		DevOpenHelper helper = new DaoMaster.DevOpenHelper(context,
				DATABASE_NAME, null);
		db = helper.getWritableDatabase();
		daoMaster = new DaoMaster(db);
		daoSession = daoMaster.newSession();
	}

	public synchronized static BaseDao getInstance(Context context) {
		if (baseDao == null) {
			baseDao = new BaseDao(context);
		}
		return baseDao;
	}

//	public JtcyDao getJtcyDao() {
//		 return daoSession.getJtcyDao();
//	}


	public BloodPressureDataDao getBloodPressureDataDao() {
		return daoSession.getBloodPressureDataDao();
	}
}
